package com.vanysoft.business.kpi.service.impl;


import com.vanysoft.business.kpi.dao.KpiItemMapper;
import com.vanysoft.business.kpi.entity.KpiItem;
import com.vanysoft.business.kpi.service.KpiItemService;
import com.vanysoft.framework.config.database.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author yu_chen
 * @date 2018-07-09 14:27
 **/
@Service
public class KpiItemServiceImpl extends BaseServiceImpl<KpiItemMapper, KpiItem> implements KpiItemService {

    @Autowired
    private KpiItemMapper kpiItemMapper;

    @Override
    public List<String> selectAllFamily() {
        return kpiItemMapper.selectAllFamily();
    }

    @Override
    public Map<String, KpiItem> selectMapKpiItem() {
        Map<String, KpiItem> map = new HashMap<>();
        List<KpiItem> kpiItems = kpiItemMapper.selectList(null);
        for (KpiItem kpiItem : kpiItems) {
            map.put(kpiItem.getId(), kpiItem);
        }
        return map;
    }
}